<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script>
    //1.根据构造函数创建对象
    function stu() {
            this.name = '小刚';
            this.age = 18;
            this.sex='男';
            this.play=function () {
                console.log('打游戏');
            }
    }
    //创建对象
    var s1=new stu();
    //访问对象中的成员属性
    console.log(s1.name);
    s1.play();

</script>